<?
$authfirst_aid = set_value('authfirst_aid',$student->auth_firstaid);
$auth_emergency = set_value('auth_emergency',$student->auth_emergency_care);
$auth_emergency_nearest_hosp = set_value('auth_emergency_nearest_hosp',$student->auth_emergency_care_hospital);
$auth_oral_non_presc = set_value('auth_oral_non_presc',$student->auth_oral_non_presc);
$first_permission = set_value('first_permission',$student->first_permission);
$second_permission = set_value('second_permission',$student->second_permission);
$third_permission = set_value('third_permission',$student->third_permission);

//CHECK if value updated , if yes check if approve, denied  or pending
/*
 * Function located at parent_helper
 */

$profile_request = isset($profile_request) ? $profile_request : false;
$req_id = isset($req_id) ? $req_id : 0;

$is_authfirst_aid = req_check_if_updated($req_id, 'auth_firstaid',$student->auth_firstaid, $profile_request);
$is_auth_emergency = req_check_if_updated($req_id, 'auth_emergency_care',$student->auth_emergency_care, $profile_request);
$is_auth_emergency_nearest_hosp = req_check_if_updated($req_id, 'auth_emergency_care_hospital',$student->auth_emergency_care_hospital, $profile_request);
$is_auth_oral_non_presc = req_check_if_updated($req_id, 'auth_oral_non_presc',$student->auth_oral_non_presc, $profile_request);
$is_first_permission = req_check_if_updated($req_id, 'first_permission',$student->first_permission, $profile_request);
$is_second_permission = req_check_if_updated($req_id, 'second_permission',$student->second_permission, $profile_request);
$is_third_permission = req_check_if_updated($req_id, 'third_permission',$student->third_permission, $profile_request);
?>
<div>
<div class="panel callout"><h6>AUTHORIZATION</h6></div>
		<?=form_open('',' class="custom profile_form" id ="authorization" ')?>
	
	<div>
		<label style="font-weight:bold;">I give consent for my child to receive the following:</label>
	</div>
	<div class="clearfix"></div>
	<div>
		<div class="large-2 columns">
			&nbsp;
		</div>
		<div class="large-5 columns">
			<label style="font-weight:bold;">*1. Minor first aid</label>
		</div>
		<div class="large-2 columns">
			<?=$is_authfirst_aid->checkbox?> <br/>
			<?php $aaclass = $is_authfirst_aid->changed?$is_authfirst_aid->class:''; ?>
			<?php if($authfirst_aid!='no'){ ?><?=form_radio('authfirst_aid', 'no', '', "class='$aaclass'");?><?php }else{ ?><?=form_radio('authfirst_aid', 'no', 'checked', "class='$aaclass'");?><?php } ?> No <?php if($authfirst_aid=='yes'){ ?><?=form_radio('authfirst_aid', 'yes', 'checked', "class='$aaclass'");?><?php }else{ ?><?=form_radio('authfirst_aid', 'yes','', "class='$aaclass'");?><?php } ?> Yes
		</div>
		<div class="large-3 columns">
			&nbsp;
		</div>
	</div>
	<div class="clearfix"></div>
	<div>
		<div class="large-2 columns">
			&nbsp;
		</div>
		<div class="large-5 columns">
			<label style="font-weight:bold;">*2. Emergency care</label>
		</div>
		<div class="large-2 columns">
			<?=$is_auth_emergency->checkbox?> <br/>
			<?php $aeclass = $is_auth_emergency->changed?$is_auth_emergency->class:''; ?>
			<?php if($auth_emergency!='no'){ ?><?=form_radio('auth_emergency', 'no','', "class='$aeclass'");?><?php }else{ ?><?=form_radio('auth_emergency', 'no', 'checked', "class='$aeclass'");?><?php } ?> No <?php if($auth_emergency=='yes'){ ?><?=form_radio('auth_emergency', 'yes', 'checked', "class='$aeclass'");?><?php }else{ ?><?=form_radio('auth_emergency', 'yes','', "class='$aeclass'");?><?php } ?> Yes
		</div>
		<div class="large-3 columns">
			&nbsp;
		</div>
	</div>
	<div class="clearfix"></div>
	<div>
		<div class="large-2 columns">
			&nbsp;
		</div>
		<div class="large-5 columns">
			<label style="font-weight:bold;">*3. Emergency care at the nearest hospital</label>
		</div>
		<div class="large-2 columns">
			<?=$is_auth_emergency_nearest_hosp->checkbox?> <br/>
			<?php $neclass = $is_auth_emergency_nearest_hosp->changed?$is_auth_emergency_nearest_hosp->class:''; ?>
			<?php if($auth_emergency_nearest_hosp!='no'){ ?><?=form_radio('auth_emergency_nearest_hosp', 'no','', "class='$neclass'");?><?php }else{ ?><?=form_radio('auth_emergency_nearest_hosp', 'no', 'checked', "class='$neclass'");?><?php } ?> No <?php if($auth_emergency_nearest_hosp=='yes'){ ?><?=form_radio('auth_emergency_nearest_hosp', 'yes', 'checked', "class='$neclass'");?><?php }else{ ?><?=form_radio('auth_emergency_nearest_hosp', 'yes','', "class='$neclass'");?><?php } ?> Yes
		</div>
		<div class="large-3 columns">
			&nbsp;
		</div>
	</div>
	<div class="clearfix"></div>
	<div>
		<div class="large-2 columns">
			&nbsp;
		</div>
		<div class="large-5 columns">
			<label style="font-weight:bold;">*4. Oral non-prescription medication</label>
		</div>
		<div class="large-2 columns">
			<?=$is_auth_oral_non_presc->checkbox?> <br/>
			<?php $opclass = $is_auth_oral_non_presc->changed?$is_auth_oral_non_presc->class:''; ?>
			<?php if($auth_oral_non_presc!='no'){ ?><?=form_radio('auth_oral_non_presc', 'no','', "class='$opclass'");?><?php }else{ ?><?=form_radio('auth_oral_non_presc', 'no', 'checked','', "class='$opclass'");?><?php } ?> No <?php if($auth_oral_non_presc=='yes'){ ?><?=form_radio('auth_oral_non_presc', 'yes', 'checked', "class='$opclass'");?><?php }else{ ?><?=form_radio('auth_oral_non_presc', 'yes','', "class='$opclass'");?><?php } ?> Yes
		</div>
		<div class="large-3 columns">
			&nbsp;
		</div>
	</div>
	<div class="clearfix"></div>
	<div>&nbsp;</div>
	<div>
		<span style="font-align:left;">*NOTE: If you answered "NO" to numbers 1, 2, and / or 3, you must provide the school with alternative emergency care instructions, to be kept in your child's school records / file.</span>
	</div>
	<div class="clearfix"></div>
	<div>&nbsp;</div>
	<div>
		<?=$is_first_permission->checkbox?> <br/>
		<?=form_error('first_permission').'<br/>';?>
		<?php $fpclass = $is_first_permission->changed?$is_first_permission->class:''; ?>
		<?php if($first_permission == 'yes'){ ?>
		<?=form_checkbox('first_permission', 'yes', TRUE, "class='left $fpclass'");?>
		<?php }else{ ?>
		<?=form_checkbox('first_permission', 'yes', FALSE, "class='left $fpclass'");?><?php } ?>&nbsp;&nbsp;<span style="font-style:italic;">Permission is hereby given for emergency measures to be initiated in case of accident or sudden illness with the undestanding that I will be notified as soon as possible.</span>
	</div>
	<div class="clearfix"></div>
	<div>&nbsp;</div>
	<div>
		<?=$is_second_permission->checkbox?> <br/>
		<?=form_error('second_permission').'<br/>';?>
		<?php $spclass = $is_second_permission->changed?$is_second_permission->class:''; ?>
		<?php if($second_permission == 'yes'){ ?>
		<?=form_checkbox('second_permission', 'yes', TRUE, "class='left $spclass'");?>
		<?php }else{ ?>
		<?=form_checkbox('second_permission', 'yes', FALSE, "class='left $spclass'");?><?php } ?>&nbsp;&nbsp;<span style="font-style:italic;">I certify that all information given is complete and correct.</span>
	</div>
	<div class="clearfix"></div>
	<div>&nbsp;</div>
	<div>
		<?=$is_third_permission->checkbox?> <br/>
		<?=form_error('third_permission').'<br/>';?>
		<?php $tpclass = $is_third_permission->changed?$is_third_permission->class:''; ?>
		<?php if($third_permission == 'yes'){ ?>
		<?=form_checkbox('third_permission', 'yes', TRUE, "class='left $tpclass'");?>
		<?php }else{ ?>
		<?=form_checkbox('third_permission', 'yes', FALSE, "class='left $tpclass'");?><?php } ?>&nbsp;&nbsp;<span style="font-style:italic;">I acknowledge that it is my responsibilty to inform Westfields IS of any changes in my child's health, physical condition or medical needs and any changes in our address and/or contact number(s).</span>
	</div>
	<div class="clearfix"></div>
	<div>&nbsp;</div>
	
	<div class="clearfix"></div>
	
	<?if(isset($student->edit) && $student->edit === 1):?>
			<div>
				<input type="hidden" name="profile_id" value="<?=$student->profile_id;?>">
				<input type="hidden" name="enrollment_id" value="<?=$student->enrollment_id;?>">
				<input type="hidden" name="update_authorization" value="true">
				<input type="submit" name="update_authorization" value="Update Student Authorization" class="btn btn-primary">
			</div>
	<?endif;?>
	
	</form>
</div>